#include "EtatRobotAVide.h"
#include "EtatRobotAVideFaceObstacle.h"

EtatRobotAVide* EtatRobotAVide::instance = NULL;

EtatRobotAVide* EtatRobotAVide::getInstance(Robot* r){

	if(instance == NULL)
		instance = new EtatRobotAVide(r);

	return instance;
}

void EtatRobotAVide::avancer(int x, int y){
	r->getPosition().setX(x);
	r->getPosition().setY(y);
}

void EtatRobotAVide::tourner(string direction){
	r->setDirection(direction);
}

void EtatRobotAVide::rencontrerObstacle(Obstacle* o){
	r->setObstacle(o);
	r->changerAncienEtat(this);
	r->changerEtat((EtatRobot*)EtatRobotAVideFaceObstacle::getInstance(r));
}

